
import React from "react";
export default class Logout extends React.Component {
    constructor(props) {
        super(props);
        this.state = {

        }
    }
    componentDidMount() {
        console.log('挂载')
    }
    componentWillUnmount() {
        console.log('销毁')
    }
    render() {
        return (
            <div>
                { this.props.name=='login'?<Gopath name='login'/>:<Gopath name='home'/>}
            </div>
        )
    }
}

class Gopath extends React.Component {
    constructor(props) {
        super(props);
        this.state = {

        }
        
    }
    aClick(props) {
        console.log(props)
    }
    render() {
        let elment;
        if (this.props.name == 'login') {
            elment = <a onClick={ this.aClick(this.props.name) }></a>
        }else {
            elment = <a onClick={ this.aClick(this.props.name) }></a>
        }
        
        return (
            <div>
                {elment}
            </div>
        )
    }
    
}
